#include "cSteeringBehaviors.h"

void SteeringBehavior::agentWander(const float& maxSpeed)
{

}

void SteeringBehavior::agentSeek(float& positionX, float& positionY, const float& targetX, 
									const float& targetY, const float& maxSpeed)
{
	//Gathers the information on the distance from the object and the class
	float distance = sqrt(((positionX - targetX) * (positionX - targetX)) + ((positionY - targetY) * (positionY - targetY)));
	float radius = 120.0f;

	distance = abs(distance);

	if(distance <= radius) {
		if(positionX > targetX)
		{
			positionX -= 0.1f;
		} 
		else 
		{
			positionX += 0.1f;
		}

		if(positionY > targetY)
		{
			positionY -= 0.1f;
		}
		else 
		{
			positionY += 0.1f;
		}
	} else {
		//Do Nothing
	}
}

void SteeringBehavior::agentFlee(float& positionX, float& positionY, const float& targetX, const float& targetY, const float& maxSpeed)
{
	float distance = sqrt(((positionX - targetX) * (positionX - targetX)) + ((positionY - targetY) * (positionY - targetY)));
	float radius = 100.0f;

	distance = abs(distance);
	if(distance <= radius)
	{
		if(positionX < targetX)
		{
			positionX += 0.1f;
		} 
		else 
		{
			positionX -= 0.1f;
		}

		if(positionY < targetY)
		{
			positionY += 0.1f;
		}
		else 
		{
			positionY -= 0.1f;
		}	
	} else {
		//Do Nothing
	}
}

void SteeringBehavior::agentArrive(float& positionX, float& positionY, const float& targetX, const float& targetY)
{
	//Calculate the distance between the target and the agent position
	float distance = sqrt(((positionX - targetX) * (positionX - targetX)) + ((positionY - targetY) * (positionY - targetY)));
	
	//Check to see if the distance is within the radius of the target

	//Slow down the agent speed if the target position is within distance

	//Bring the agent speed to zero if the target position is very close to agent
}

void SteeringBehavior::agentAlign(float& positionX, float& positionY)
{
	//Check the position of the agent and target

	//Calculate the distance between the agent and target

	//Create spacing between the agent and the target
}

void SteeringBehavior::agentAttack(const bool& bIsAttacking)
{
	//Check to see if the enemy is in front of the player (Arrive)

	//Calculate the damage of the attack
}